using System;
using System.Collections.Generic;
using System.Text;

namespace mds.Queue
{
	/// <summary>
	/// This delegate is serialized along with an IQueueProcessable object and gets
	/// called instead of the ProcessDelegate associated with a QueueProcessor
	/// </summary>
	/// <param name="item">The IQueueProcessable object to process, this will always be the
	/// IQueueProcessable object that is queued with this delegate.
	/// </param>
    /// <see>Beisen.Queue.IQueueProcessable</see>
	[Serializable]
	public delegate void QueueProcessDelegate(object item);

	/// <summary>
	/// Classes that inherit from this will have their ProcessItem delegate run on dequeue
	/// instead of the ProcessDelegate that's associated with the QueueProcessor in which
	/// the item was enqueued.
	/// 
	/// The object that inherits from this needs to be marked Serializable because the
	/// delegate gets serialized along with the context of the object that contains it.
	/// </summary>
    /// <see>Beisen.Queue.QueueProcessDelegate</see>
	public interface IQueueProcessable
	{
		/// <summary>
		/// This will get called when the item is dequeued instead of the ProcessDelegate 
		/// associated with the QueueProcessor
		/// </summary>
		QueueProcessDelegate ProcessItem
		{
			get;
			set;
		}
	}
}
